<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
    <meta content="text/html;charset=utf-8"></meta>
    <title>用户维护</title>
    <link rel="stylesheet" href="/static/js/common/bootstrap/css/bootstrap.min.css"></link>
    <link rel="stylesheet" href="/static/js/common/layer/theme/default/layer.css"></link>
    <link rel="stylesheet" href="/static/css/base.css"></link>

    <script src="/static/js/common/jquery/jquery-3.2.1.min.js"></script>
    <script src="/static/js/common/layer/layer.js"></script>
    <script src="/static/js/base/base.js"></script>
    <script>

        //删除记录
        function deleteRecord(data) {
            var url = "${basePath}" + "/bus/config/delete/";
            defaultDelRecord(data, url);
        }

        //修改模态窗弹出
        function modifyModal(data) {
            var url = "${basePath}" + "/bus/config/info/";
            defaultSkipModifyModal(data, url);
        }

        //修改提交
        function modifyRecord() {
            var url = "${basePath}" + "/bus/config/modify/";
            defaultUpdateRecord(url)
        }

        //新增提交
        function addRecord() {
            var url = "${basePath}" + "/bus/config/add/";
            defaultAddRecord(url);
        }


        function openAddModel(data){
            // alert($(data).attr("data-toggle"));
            $("#consName_add").attr("value", $(data).attr("data-toggle"));
            $("#busId_add").attr("value", ${listResult.remark.busId?default("")});

            $('#modal_add').modal('show');
        }
    </script>
</head>
<body>
 <@_top.top 1/>
<div class="container" style="padding-bottom: 15px;min-height: 300px; padding-top: 60px;">
    <div class="row">
        <@_left.bus_menu 2/>
        <div class="col-md-10  col-xs-10">
            <h2>商户配置列表(${listResult.remark.busName?default("")})</h2>
            <hr>
            <#--<form class="form-inline" id="queryForm" role="form">-->
                <#--<input type="text" name="username" class="form-control" id="queryName" placeholder="请输入名称">-->
                <#--<button type="button" onclick="listRecord(this)" class="btn btn-primary">查询</button>-->
                <#--<button type="button" class="btn btn-success" data-toggle="modal" data-target="#modal_add" >添加</button>-->
                <#--<!-- 表示应谨慎采取的动作 &ndash;&gt;-->
            <#--</form>-->
            <#--<hr>-->
            <!-- 表格 -->
            <div id="list_table">
            <#list listResult.list as consVO>

                <table class="table table-hover" id="role_grade">
                <caption>
                    ${consVO.consLabel?default("")}  <button type="button" class="btn btn-success" style="padding:4px;margin:0;float:right;" data-toggle="${consVO.consName?default('')}" onclick="openAddModel(this)" >添加</button>
                </caption>
                <thead>
                <tr>
                    <#--<th>序号</th>-->
                    <#--<th>常量名</th>-->
                    <th class="col-md-2 text-center">配置名</th>
                    <th class="col-md-2 text-center">配置值</th>
                    <th class="col-md-2 text-center">备注</th>

                    <th class="col-md-2 text-center">操作</th>
                </tr>
                </thead>
                <tbody>
                <#list consVO.configList as busConfigVO>
                <tr>
                    <td style="display: none">${busConfigVO.id}</td>
                    <#--<td>${busConfigVO_index  + 1}</td>-->
                    <#--<td id="consName_${busConfigVO.id}">${busConfigVO.consName?default("")}</td>-->
                    <td class="col-md-2 text-center">${busConfigVO.configName?default("")}</td>
                    <td class="col-md-2 text-center">${busConfigVO.configValue?default("")}</td>
                    <td class="col-md-2 text-center">${busConfigVO.remark?default("")}</td>

                    <td class="col-md-2 text-center">
                        <button id="update" type="button" onclick="modifyModal(this)"  style="padding:4px;margin:0;" class="btn btn-warning">修改</button>
                        <button id="delete" type="delete" onclick="deleteRecord(this)" style="padding:4px;margin:0;" class="btn btn-danger">删除</button>
                    </td>
                </tr>
                </#list>
                </tbody>
            </table>

            </#list>
            </div>


        </div>
    </div>
</div>

<div class="modal fade" id="modal_add" style="padding-top: 150px" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    新增配置项
                </h4>
            </div>
            <div class="modal-body">
                <form id="form_add" class="form-horizontal" role="form">
                    <div class="form-group hidden">
                        <label for="firstname" class="col-sm-2 control-label">ID</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="userId" name="id" value="">
                        </div>
                    </div>
                    <div class="form-group" style="display: none">
                        <label for="firstname" class="col-sm-2 control-label">常量名</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="consName_add" name="consName" placeholder="请输入常量名" value="">
                            <input type="text" class="form-control" id="busId_add" name="busId"  value="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="firstname" class="col-sm-2 control-label">配置名</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="configName_add" name="configName" placeholder="请输入配置名" value="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="firstname" class="col-sm-2 control-label">配置值</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="configValue_add" name="configValue" placeholder="请输入配置值" value="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="firstname" class="col-sm-2 control-label">备注</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="remark_add" name="remark" placeholder="请输入备注" value="">
                        </div>
                    </div>

                </form>
            </div>
            <div class="modal-footer">
                <button type="button" id="modalCancel" onclick="function close() {
                            $('#modal_add').modal('hide');
                        }" class="btn btn-default" data-dismiss="modal">取消
                </button>
                <button type="button" id="button_add" onclick="addRecord()" class="btn btn-primary">
                    提交
                </button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

<div id="info_modify">

</div>


<script src="/static/js/common/bootstrap/js/bootstrap.min.js"></script>

</body>

</html>





